package com.ys.web.user.info;

import com.ys.utils.base.j2se.StringHandler;
import com.ys.utils.datasource.DataSourceBy;
import com.ys.web.user.login.LoginInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserInfoService {
    @Autowired
    private UserInfoMapper userInfoMapper;

    public int updateUserNickName(UserInfo info){
        return userInfoMapper.updateUserNickName(info);
    }

    public int updateUserAvatarUrl(UserInfo info){
        return userInfoMapper.updateUserAvatarUrl(info);
    }

    public int updateUserPhone(UserInfo info){
        return userInfoMapper.updateUserPhone(info);
    }

    public List<UserInfo> getUserInfoByIds(List<Long> list){return userInfoMapper.getUserInfoByIds(list);}

    public Integer getOpenAccountCountByCardNo(String cardNo){return userInfoMapper.getOpenAccountCountByCardNo(cardNo);}

    public long getOpenAccountCountMbCardNo(String cardNo){
        Long uid = userInfoMapper.getOpenAccountCountMbCardNo(cardNo);
        return StringHandler.isEmpty(uid)?0:uid;
    }

    public int updateRealByUser(LoginInfo loginInfo){return userInfoMapper.updateRealByUser(loginInfo);}

    public UserInfo getUserInfoById(Long id){
        return userInfoMapper.getUserInfoById(id);
    }

    public Integer getOpenAccountCountByPhone(String phone) {
        return userInfoMapper.getOpenAccountCountByPhone(phone);
    }

    @DataSourceBy("ysIm")
    public int ysMerchantInsert(Map<String, Object> ys_mct) {
        return userInfoMapper.ysMerchantInsert(ys_mct);
    }
    @DataSourceBy("ysIm")
    public int ysMerchantUpdate(Map<String, Object> ys_mct) {
        return userInfoMapper.ysMerchantUpdate(ys_mct);
    }
    @DataSourceBy("ysIm")
    public int getUserMerchantCount(String uid) {
        return userInfoMapper.getUserMerchantCount(uid);
    }

    @DataSourceBy("ysIm")
    public int getUserIdCordCount(String uid) {
        return userInfoMapper.getUserIdCordCount(uid);
    }
    @DataSourceBy("ysIm")
    public int userIdCordUpdate(Map<String, Object> ys_mct) {
        return userInfoMapper.userIdCordUpdate(ys_mct);
    }
    @DataSourceBy("ysIm")
    public int userIdCordInsert(Map<String, Object> ys_mct) {
        return userInfoMapper.userIdCordInsert(ys_mct);
    }
    @DataSourceBy("ysIm")
    public int updatePhone(String uid, String phone) {
        return userInfoMapper.updatePhone(uid,phone);
    }
    @DataSourceBy("ysIm")
    public Map<String, Object> getUserIdCord(String uid) {
        return userInfoMapper.getUserIdCord(uid);
    }

    @DataSourceBy("ysIm")
    public int updateAliByUser(LoginInfo loginInfo){return userInfoMapper.updateAliByUser(loginInfo);}
    @DataSourceBy("ysIm")
    public LoginInfo getUserInfo(Long id){
        return userInfoMapper.getUserInfo(id);
    }

    @DataSourceBy("ysIm")
    public int realIdCardUp(String uid, int realIdCardUp) {
        return userInfoMapper.realIdCardUp(uid,realIdCardUp);
    }


    @DataSourceBy("ysIm")
    public int getUserBankCount(String uid) {
        return userInfoMapper.getUserBankCount(uid);
    }

    @DataSourceBy("ysIm")
    public int userWithdrawBlackInsert(long uid, long createTime) {
        return userInfoMapper.userWithdrawBlackInsert(uid,createTime);
    }

    @DataSourceBy("ysIm")
    public int withdrawRecordStatus(long uid, int status) {
        return userInfoMapper.withdrawRecordStatus(uid,status);
    }


    @DataSourceBy("ysIm")
    public List<Map<String,Object>> userLogout() {
        return userInfoMapper.userLogout();
    }
    @DataSourceBy("ysIm")
    public int getNickNameInfo(String nickName) {
        return userInfoMapper.getNickNameInfo(nickName);
    }
}
